var e = require;
var t = module;
var o = exports;
var n = o;
Object.defineProperty(n, "__esModule", {value: !0});
var i = e("Util"),
    a = e("GameData"),
    r = (function () {
        function e() {
            (this.data = {Fraction: 0, SnakeDie: 0, Shit: 0, HotPot: 0, Dumplings: 0, RoastChicken: 0, eggNum: 0}),
                (this.task_list = [
                    "当日累计积分达到5000",
                    "当日累计积分达到10000",
                    "当日累计积分达到50000",
                    "当日击杀20次",
                    "当日吃元宝给500个",
                    "当日吃火锅100个",
                    "当日吃包子100个",
                    "当日吃红烧肉100个",
                    "拧开一个扭蛋"
                ]),
                (this.task_coin = [20, 30, 50, 100, 30, 30, 30, 30, 100]);
        }
        return (
            Object.defineProperty(e, "instance", {
                get: function () {
                    return e._instance || (e._instance = new e()), e._instance;
                },
                enumerable: !1,
                configurable: !0
            }),
            Object.defineProperty(e.prototype, "task_list_index", {
                get: function () {
                    return ad.curr_platform == window.ad.Platform.TOU_TIAO
                        ? ((this.task_list[4] = "当日吃彩虹糖给500个"), [0, 1, 2, 3, 4, 5, 6, 7, 8])
                        : [0, 1, 2, 3, 4, 5, 6, 7, 8];
                },
                enumerable: !1,
                configurable: !0
            }),
            (e.prototype.getTaskProgressByIndex = function (t) {
                var o = 0;
                return (
                    0 == t
                        ? (o = e.instance.getPlayerFractionData(5e3))
                        : 1 == t
                        ? (o = e.instance.getPlayerFractionData(1e4))
                        : 2 == t
                        ? (o = e.instance.getPlayerFractionData(5e4))
                        : 3 == t
                        ? (o = e.instance.getSnakeDieData())
                        : 4 == t
                        ? (o = e.instance.getFoodDataByShit())
                        : 5 == t
                        ? (o = e.instance.getFoodDataByHotPot())
                        : 6 == t
                        ? (o = e.instance.getFoodDataByDumplings())
                        : 7 == t
                        ? (o = e.instance.getFoodDataByRoastChicken())
                        : 8 == t && (o = e.instance.getFoodDataByEgg()),
                    o
                );
            }),
            (e.prototype.getTaskDataByIndex = function (e) {
                var t = [0, 0];
                return (
                    0 == e
                        ? (t = [this.data.Fraction, 5e3])
                        : 1 == e
                        ? (t = [this.data.Fraction, 1e4])
                        : 2 == e
                        ? (t = [this.data.Fraction, 5e4])
                        : 3 == e
                        ? (t = [this.data.SnakeDie, 20])
                        : 4 == e
                        ? (t = [this.data.Shit, 500])
                        : 5 == e
                        ? (t = [this.data.HotPot, 100])
                        : 6 == e
                        ? (t = [this.data.Dumplings, 100])
                        : 7 == e
                        ? (t = [this.data.RoastChicken, 100])
                        : 8 == e && (t = [this.data.eggNum, 100]),
                    t
                );
            }),
            (e.prototype.ResetData = function () {
                i.default.getTodayStr() != i.default.getItem("TaskDataRefreshTimer", "000") &&
                    (i.default.setItem("TaskData", JSON.stringify(this.data)),
                    i.default.setItem("TaskDataRefreshTimer", i.default.getTodayStr())),
                    (this.data = JSON.parse(i.default.getItem("TaskData", JSON.stringify(this.data))));
            }),
            (e.prototype.collectFoodData = function (e) {
                e.foodType == a.FoodType.Shit
                    ? (this.data.Shit += 1)
                    : e.foodType == a.FoodType.FirstFood && 1 == e.foodIndex
                    ? (this.data.HotPot += 1)
                    : e.foodType == a.FoodType.FirstFood && 2 == e.foodIndex
                    ? (this.data.Dumplings += 1)
                    : e.foodType == a.FoodType.FirstFood && 3 == e.foodIndex && (this.data.RoastChicken += 1);
            }),
            (e.prototype.collectSnakeDieData = function (e, t) {
                t == a.default.instance.UserName &&
                    ((this.data.SnakeDie += 1), i.default.setItem("TaskData", JSON.stringify(this.data)));
            }),
            (e.prototype.collectPlayerFractionData = function (e) {
                (this.data.Fraction += e), i.default.setItem("TaskData", JSON.stringify(this.data));
            }),
            (e.prototype.collectPlayerEggData = function () {
                (this.data.eggNum += 1), i.default.setItem("TaskData", JSON.stringify(this.data));
            }),
            (e.prototype.getPlayerFractionData = function (e) {
                var t = this.data.Fraction / e;
                return t > 1 && (t = 1), Number(t.toFixed(2));
            }),
            (e.prototype.getSnakeDieData = function () {
                var e = this.data.SnakeDie / 20;
                return e > 1 && (e = 1), Number(e.toFixed(2));
            }),
            (e.prototype.getFoodDataByShit = function () {
                var e = this.data.Shit / 500;
                return e > 1 && (e = 1), Number(e.toFixed(2));
            }),
            (e.prototype.getFoodDataByHotPot = function () {
                var e = this.data.HotPot / 100;
                return e > 1 && (e = 1), Number(e.toFixed(2));
            }),
            (e.prototype.getFoodDataByDumplings = function () {
                var e = this.data.Dumplings / 100;
                return e > 1 && (e = 1), Number(e.toFixed(2));
            }),
            (e.prototype.getFoodDataByRoastChicken = function () {
                var e = this.data.RoastChicken / 100;
                return e > 1 && (e = 1), Number(e.toFixed(2));
            }),
            (e.prototype.getFoodDataByEgg = function () {
                var e = this.data.eggNum / 1;
                return e > 1 && (e = 1), Number(e.toFixed(2));
            }),
            (e._instance = null),
            e
        );
    })();
(n.default = r), r.instance.ResetData();
